package com.stox.charting.ui.swing.presenter.delegate.builder;

import com.stox.charting.ui.swing.model.Chart;
import com.stox.charting.ui.swing.model.indicator.VolumeChart;
import com.stox.charting.ui.swing.model.price.PriceChart;
import com.stox.ioc.SmartContainer;

public class ChartBuilder {

	
	
	@SuppressWarnings("unchecked")
	public <T extends Chart<?>> T build(Class<T> clazz){
		T chart = null;
		if(clazz.isAssignableFrom(PriceChart.class)){
			chart = (T) SmartContainer.instance().getPrototype(PriceChart.class);
		}else if(clazz.isAssignableFrom(VolumeChart.class)){
			chart = (T) SmartContainer.instance().getPrototype(VolumeChart.class);
		}
		return chart;
	}

}
